//
//  UITableView+Extension.swift
//  FrameProduct
//
//  Created by delegate on 2024/2/3.
//
import UIKit

public extension UITableView {

    func registerCellClass<T>(_ cellClass: T.Type) where T: ReuseIdentifiable {
        register(T.self, forCellReuseIdentifier: T.reuseIdentifier)
    }
    func registerHeaderFooterViewClass<T>(_ cellClass: T.Type) where T: ReuseIdentifiable {
        register(T.self, forHeaderFooterViewReuseIdentifier: T.reuseIdentifier)
    }

    func dequeueReusableCell<T>(_ cellClass: T.Type, for indexPath: IndexPath) -> T where T: ReuseIdentifiable {
        return dequeueReusableCell(withIdentifier: T.reuseIdentifier, for: indexPath) as! T
    }

    func dequeueReusableHeaderFooterView<T>(_ cellClass: T.Type) -> T where T: ReuseIdentifiable {
        return dequeueReusableHeaderFooterView(withIdentifier: T.reuseIdentifier) as! T
    }

}
